<?php

/**
 * Fichier form base class.
 *
 * @method Fichier getObject() Returns the current form's model object
 *
 * @package    jobeat
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseFichierForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'               => new sfWidgetFormInputHidden(),
      'attrnomorigine'   => new sfWidgetFormInputText(),
      'attrnomserver'    => new sfWidgetFormInputText(),
      'attrtypefichier'  => new sfWidgetFormInputText(),
      'attrurlfichier'   => new sfWidgetFormInputText(),
      'attrtaille'       => new sfWidgetFormInputText(),
      'attrextension'    => new sfWidgetFormInputText(),
      'attrdatecreation' => new sfWidgetFormInputText(),
      'attretat'         => new sfWidgetFormChoice(array('choices' => array('Validé' => 'Validé', 'Refusé' => 'Refusé', 'En Cours' => 'En Cours'))),
      'attrurlminiature' => new sfWidgetFormInputText(),
      'fkutilisateur'    => new sfWidgetFormInputText(),
      'fkdossierparent'  => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'attrnomorigine'   => new sfValidatorString(array('max_length' => 50)),
      'attrnomserver'    => new sfValidatorString(array('max_length' => 250)),
      'attrtypefichier'  => new sfValidatorString(array('max_length' => 20)),
      'attrurlfichier'   => new sfValidatorString(array('max_length' => 250)),
      'attrtaille'       => new sfValidatorString(array('max_length' => 20)),
      'attrextension'    => new sfValidatorString(array('max_length' => 10)),
      'attrdatecreation' => new sfValidatorInteger(),
      'attretat'         => new sfValidatorChoice(array('choices' => array(0 => 'Validé', 1 => 'Refusé', 2 => 'En Cours'), 'required' => false)),
      'attrurlminiature' => new sfValidatorString(array('max_length' => 250, 'required' => false)),
      'fkutilisateur'    => new sfValidatorInteger(),
      'fkdossierparent'  => new sfValidatorInteger(),
    ));

    $this->widgetSchema->setNameFormat('fichier[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Fichier';
  }

}
